.mxf, and .ozi. From Alex Mottram.
FMTS=magproto.o gpx.o geo.o gpsman.o mapsend.o mapsource.o \
gpsutil.o tiger.o pcx.o csv.o cetus.o gpspilot.o magnav.o \
- psp.o mxf.o holux.o garmin.o ozi.o dna.o
+ psp.o mxf.o holux.o garmin.o ozi.o dna.o tpg.o
JEEPS=jeeps/gpsapp.o jeeps/gpscom.o jeeps/gpsfmt.o jeeps/gpsinput.o \
jeeps/gpsmath.o jeeps/gpsmem.o \
mkshort.o: mkshort.c defs.h queue.h
mxf.o: mxf.c defs.h queue.h csv_util.h
ozi.o: ozi.c defs.h queue.h csv_util.h
+tpg.o: tpg.c defs.h queue.h
pcx.o: pcx.c defs.h queue.h
psp.o: psp.c defs.h queue.h
queue.o: queue.c queue.h
char *shortname = NULL;
char *description = NULL;
- if (wpt->shortname) {
+ if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
+ if (wpt->description) {
+ if (global_opts.synthesize_shortnames)
+ shortname = mkshort(wpt->description);
+ else
+ shortname = csv_stringclean(wpt->description, ",\"");
+ } else {
+ /* no description available */
+ shortname = xstrdup("");
+ }
+ } else{
shortname = csv_stringclean(wpt->shortname, ",\"");
- shortname = csv_stringtrim(shortname, "");
- } else {
- shortname = xstrdup("");
}
-
- if (wpt->description) {
+
+ if (! wpt->description) {
+ if (shortname) {
+ description = csv_stringclean(shortname, ",\"");
+ } else {
+ description = xstrdup("");
+ }
+ } else{
description = csv_stringclean(wpt->description, ",\"");
- description = csv_stringtrim(description, "");
- } else {
- shortname = xstrdup("");
}
-
+
fprintf(file_out, "%08.5f, %08.5f, \"%s\", \"%s\", \"%s\", %s, %d\n",
wpt->position.latitude.degrees, wpt->position.longitude.degrees,
description, shortname, description,
static void
data_write(void)
{
+ if (global_opts.synthesize_shortnames) {
+ setshort_length(32);
+ setshort_whitespace_ok(0);
+ setshort_badchars("\",");
+ }
+
waypt_disp_all(mxf_waypt_pr);
}
ozi_time = (wpt->creation_time / 86400.0) + 25569.0;
alt_feet = (wpt->position.altitude.altitude_meters * 3.2808);
- if (wpt->description)
- description = csv_stringclean(wpt->description, ",");
- else
- description = xstrdup("");
-
- if (wpt->shortname)
+ if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
+ if (wpt->description) {
+ if (global_opts.synthesize_shortnames)
+ shortname = mkshort(wpt->description);
+ else
+ shortname = csv_stringclean(wpt->description, ",");
+ } else {
+ /* no description available */
+ shortname = xstrdup("");
+ }
+ } else{
shortname = csv_stringclean(wpt->shortname, ",");
- else
- shortname = xstrdup("");
+ }
+
+ if (! wpt->description) {
+ if (shortname) {
+ description = csv_stringclean(shortname, ",");
+ } else {
+ description = xstrdup("");
+ }
+ } else{
+ description = csv_stringclean(wpt->description, ",");
+ }
index++;
fprintf(file_out, "Reserved 2\n");
fprintf(file_out, "Reserved 3\n");
+ if (global_opts.synthesize_shortnames) {
+ setshort_length(32);
+ setshort_whitespace_ok(0);
+ setshort_badchars("\",");
+ }
+
waypt_disp_all(ozi_waypt_pr);
}
int i;
char *shortname;
char *description;
-
- /* this output format pretty much requires a description
- * and a shortname
- */
-
- if (wpt->shortname) {
- shortname = xstrdup(wpt->shortname);
- } else {
- if (wpt->description)
- shortname = xstrdup(wpt->description);
- else
+ if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
+ if (wpt->description) {
+ if (global_opts.synthesize_shortnames)
+ shortname = mkshort(wpt->description);
+ else
+ shortname = xstrdup(wpt->description);
+ } else {
+ /* no description available */
shortname = xstrdup("");
+ }
+ } else{
+ shortname = xstrdup(wpt->shortname);
}
-
- if (wpt->description) {
+
+ if (! wpt->description) {
+ if (shortname) {
+ description = xstrdup(shortname);
+ } else {
+ description = xstrdup("");
+ }
+ } else{
description = xstrdup(wpt->description);
- } else {
- description = xstrdup(shortname);
- }
+ }
/* convert lat/long back to radians */
lat = (wpt->position.latitude.degrees * M_PI) / 180.0;
/* offset 0x0C - 0x0D = 2 byte pin count */
s = waypt_count();
+
+ if (global_opts.synthesize_shortnames) {
+ setshort_length(32);
+ setshort_whitespace_ok(1);
+ }
if (s > MAXPSPOUTPUTPINS) {
fatal(MYNAME ": attempt to output too many pushpins (%d). The max is %d. Sorry.\n", s, MAXPSPOUTPUTPINS);
${PNAME} -i mxf -f ${TMPDIR}/mx.mxf -o mxf -F ${TMPDIR}/mxf.mxf
diff ${TMPDIR}/mxf.mxf reference
+# TPG (NG Topo!) file format
+# This is hard to test as the datum conversions create minute
+# inconsistencies in the coordinates. So.. we test our i/o
+# against a format that rounds higher than we care to compare
+# for binary data.
+rm -f ${TMPDIR}/topo.mxf ${TMPDIR}/tpg.mxf ${TMPDIR}/geo.tpg
+${PNAME} -i geo -f geocaching.loc -o tpg -F ${TMPDIR}/geo.tpg
+${PNAME} -i tpg -f ${TMPDIR}/geo.tpg -o mxf -F ${TMPDIR}/tpg.mxf
+${PNAME} -i tpg -f reference/tpg.tpg -o mxf -F ${TMPDIR}/topo.mxf
+diff ${TMPDIR}/tpg.mxf ${TMPDIR}/topo.mxf
+
# OZI (OziExplorer 1.1) file format
rm -f ${TMPDIR}/oz.ozi ${TMPDIR}/ozi.ozi
${PNAME} -i ozi -f reference/ozi.ozi -o ozi -F ${TMPDIR}/oz.ozi
extern ff_vecs_t mxf_vecs;
extern ff_vecs_t holux_vecs;
extern ff_vecs_t ozi_vecs;
+extern ff_vecs_t tpg_vecs;
extern ff_vecs_t dna_vecs;
extern ff_vecs_t xmap_vecs;
"ozi",
"OziExplorer Waypoint"
},
+ {
+ &tpg_vecs,
+ "tpg",
+ "National Geographic Topo .tpg"
+ },
{
NULL,